using System;
using UnityEngine;

public class Line : MonoBehaviour
{
   [Header("线渲染器")]
   public LineRenderer lineRenderer;
   [Header("纹理偏移速度")]
   public float offsetSpeed = 0.1f;

   private void Update()
   {
      if (lineRenderer != null)
      {
         //获取当前纹理偏移
         var offset = lineRenderer.material.mainTextureOffset;
         //设置纹理偏移
         offset.x += offsetSpeed * Time.deltaTime;
         //重新赋值纹理偏移
         lineRenderer.material.mainTextureOffset = offset;
      }
   }
}
